package jumpingnotes.deploy;

import jumpingnotes.codec.CodecParams;
import jumpingnotes.model.Deploy;

public interface DeployService {
	/**
	 * Do the deployment.
	 * The deployment will
	 * (1) add a codec task if necessary.
	 * (2) generate a deploy sync file per sync file template and
	 *     deployment method.
	 * (3) package the deployment. The packaging occurs at once
	 *     if codec task is not necessary or when the codec
	 *     task is completed.
	 * The method might also update some fields in Deploy object. It
	 * is recommended to persistent it after the method call.
	 * @param deploy The deploy object.
	 * @param taskContext The context to be added to codec task
	 * if applicable.
	 * @return >0 if the codec task is scheduled,
	 * ==0 if the no need to add a codec task,
	 * <0 if failure occurs.
	 */
	int deploy(Deploy deploy, Object taskContext, CodecParams codecParams);
	
	void addListener(DeployEventListener listener);
	
	void removeListener(DeployEventListener listener);
}
